package com.alibaba.nacos.config.server.jpa.entity;

import java.time.LocalDateTime;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

/**
 * @author
 * @date 2020-03-08 23:31
 * 租户容量信息表
 */
@Entity
@Table(name = "NACOS_TENANT_CAPACITY",uniqueConstraints = {
    @UniqueConstraint(name = "UK_TENANTID", columnNames = {"TENANT_ID"})
})
public class TenantCapacityEntity extends AbstractEntity {

    private static final long serialVersionUID = 1L;

    public TenantCapacityEntity () {}

    /**
     * 创建时间
     */
    @Column(name = "GMT_CREATE", nullable = false)
    @CreatedDate
    private LocalDateTime gmtCreate;

    /**
     * 修改时间
     */
    @Column(name = "GMT_MODIFIED", nullable = false)
    @LastModifiedDate
    private LocalDateTime gmtModified;

    /**
     * 聚合子配置最大个数
     */
    @Column(name = "MAX_AGGR_COUNT", nullable = false)
    private String maxAggrCount;

    /**
     * 单个聚合数据的子配置大小上限，单位为字节，0表示使用默认值
     */
    @Column(name = "MAX_AGGR_SIZE", nullable = false)
    private String maxAggrSize;

    /**
     * 最大变更历史数量
     */
    @Column(name = "MAX_HISTORY_COUNT", nullable = false)
    private String maxHistoryCount;

    /**
     * 单个配置大小上限，单位为字节，0表示使用默认值
     */
    @Column(name = "MAX_SIZE", nullable = false)
    private String maxSize;

    /**
     * 配额，0表示使用默认值
     */
    @Column(name = "QUOTA", nullable = false)
    private String quota;

    /**
     * Tenant ID
     */
    @Column(name = "TENANT_ID", nullable = false)
    private String tenantId;

    /**
     * 使用量
     */
    @Column(name = "[USAGE]", nullable = false)
    private String usage;

    public TenantCapacityEntity setGmtCreate(LocalDateTime gmtCreate){
        this.gmtCreate = gmtCreate;
        return this;
    }

    public LocalDateTime getGmtCreate(){
        return gmtCreate;
    }

    public TenantCapacityEntity setGmtModified(LocalDateTime gmtModified){
        this.gmtModified = gmtModified;
        return this;
    }

    public LocalDateTime getGmtModified(){
        return gmtModified;
    }

    public TenantCapacityEntity setMaxAggrCount(String maxAggrCount){
        this.maxAggrCount = maxAggrCount;
        return this;
    }

    public String getMaxAggrCount(){
        return maxAggrCount;
    }

    public TenantCapacityEntity setMaxAggrSize(String maxAggrSize){
        this.maxAggrSize = maxAggrSize;
        return this;
    }

    public String getMaxAggrSize(){
        return maxAggrSize;
    }

    public TenantCapacityEntity setMaxHistoryCount(String maxHistoryCount){
        this.maxHistoryCount = maxHistoryCount;
        return this;
    }

    public String getMaxHistoryCount(){
        return maxHistoryCount;
    }

    public TenantCapacityEntity setMaxSize(String maxSize){
        this.maxSize = maxSize;
        return this;
    }

    public String getMaxSize(){
        return maxSize;
    }

    public TenantCapacityEntity setQuota(String quota){
        this.quota = quota;
        return this;
    }

    public String getQuota(){
        return quota;
    }

    public TenantCapacityEntity setTenantId(String tenantId){
        this.tenantId = tenantId;
        return this;
    }

    public String getTenantId(){
        return tenantId;
    }

    public TenantCapacityEntity setUsage(String usage){
        this.usage = usage;
        return this;
    }

    public String getUsage(){
        return usage;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("TenantCapacityEntity = {");

        if (gmtCreate != null){
            sb.append("gmtCreate = ").append(gmtCreate).append(", ");
        }
        if (gmtModified != null){
            sb.append("gmtModified = ").append(gmtModified).append(", ");
        }
        if (id != null){
            sb.append("id = ").append(id).append(", ");
        }
        if (maxAggrCount != null){
            sb.append("maxAggrCount = ").append(maxAggrCount).append(", ");
        }
        if (maxAggrSize != null){
            sb.append("maxAggrSize = ").append(maxAggrSize).append(", ");
        }
        if (maxHistoryCount != null){
            sb.append("maxHistoryCount = ").append(maxHistoryCount).append(", ");
        }
        if (maxSize != null){
            sb.append("maxSize = ").append(maxSize).append(", ");
        }
        if (quota != null){
            sb.append("quota = ").append(quota).append(", ");
        }
        if (tenantId != null){
            sb.append("tenantId = ").append(tenantId).append(", ");
        }
        if (usage != null){
            sb.append("usage = ").append(usage);
        }

        sb.append("}");
        return sb.toString();
    }

}
